package com.mall.biz.trade.impl.o2o.incluce;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.mall.biz.trade.O2OTradeBiz;
import com.mall.client.order.MallItemOrderService;
import com.mall.dto.TradePriceAndBuyCountDTO;
import com.mall.pojo.MallItemOrder;
import com.mall.pojo.Trade;

@Service
public class ZhiHuiTradeImpl implements O2OTradeBiz {
	
	@Autowired
	private MallItemOrderService mallItemOrderService;

	@Override
	public TradePriceAndBuyCountDTO pack4PirceAndBuyCount(HttpServletRequest request, Integer type, Long price,
			Integer buyCount, Long parentId) {
		TradePriceAndBuyCountDTO tradePriceAndBuyCountDTO = new TradePriceAndBuyCountDTO();
		MallItemOrder mallItemOrder = this.mallItemOrderService.getMallItemOrderById(parentId);
		if(mallItemOrder ==null){
			return null; // TODO 跳转到error页
		}
		tradePriceAndBuyCountDTO.setPrice(mallItemOrder.getPrice());
		tradePriceAndBuyCountDTO.setBuyCount(mallItemOrder.getBuyCount());
		tradePriceAndBuyCountDTO.setDiscountPrice(0l);
		return tradePriceAndBuyCountDTO;
	}

	

	@Override
	public Boolean beforeInsert(HttpServletRequest request,Trade trade) {
		// TODO Auto-generated method stub
		return null;
	}



	@Override
	public Boolean afterSuccInsert(HttpServletRequest request, Trade trade) {
		// TODO Auto-generated method stub
		return null;
	}



	@Override
	public Boolean afterErrorInsert(HttpServletRequest request, Trade trade) {
		// TODO Auto-generated method stub
		return null;
	}

}
